package cn.wolfcode.car.business.query;

import cn.wolfcode.car.business.domain.Department;
import cn.wolfcode.car.common.base.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Calendar;
import java.util.Date;

@Getter@Setter
public class EmployeeQuery extends QueryObject {

    private String keyword;

    private Integer admin; //是否超管

    private Integer status; // 是否冻结

    private Date hiredate; //入职时间

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date beginTime; // 开始时间

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    private Date endTime;   // 结束时间

    private Long  deptId; //部门id

    public Date getEndTime() {
        if (this.endTime != null) {
            Calendar calendar = Calendar.getInstance();
            calendar.setTime(this.endTime);
            calendar.set(Calendar.HOUR_OF_DAY,23);
            calendar.set(Calendar.MINUTE,59);
            calendar.set(Calendar.SECOND,59);
            return calendar.getTime();
        }
        return null;
    }
}
